package com.smh.a06regexDemo6;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexDemo {
    public static void main(String[] args) {

        String s = "abbbbbbbbbbbbbaaaaaaaaaaaa";

        //贪婪爬取:在爬取数据时尽可能多获取
        //非贪婪爬取:尽可能少获得
        /*
        * 只写+和*是贪婪
        *   +?
        *    *?都是非贪婪
        *
        *
        *
        * */
        //*   0次或多次
        String regex = "ab+";
        String regex3 = "ab*";
        String regex2 = "ab+?";
        String regex4 = "ab*?";

        Pattern p =Pattern.compile(regex3);
        Matcher m = p.matcher(s);
        while (m.find()){
            System.out.println(m.group());
        }

    }
}
